/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package REABR.impl;

import REA.REAOperationalEntity;
import REA.REAPolicyEntity;

import REABR.AssociationPolicy;
import REABR.REABRPackage;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Association Policy</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link REABR.impl.AssociationPolicyImpl#getPolicyEntities <em>Policy Entities</em>}</li>
 *   <li>{@link REABR.impl.AssociationPolicyImpl#getOperationalEntities <em>Operational Entities</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AssociationPolicyImpl extends PolicyImpl implements AssociationPolicy {
	/**
	 * The cached value of the '{@link #getPolicyEntities() <em>Policy Entities</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPolicyEntities()
	 * @generated
	 * @ordered
	 */
	protected EList<REAPolicyEntity> policyEntities;

	/**
	 * The cached value of the '{@link #getOperationalEntities() <em>Operational Entities</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOperationalEntities()
	 * @generated
	 * @ordered
	 */
	protected EList<REAOperationalEntity> operationalEntities;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AssociationPolicyImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return REABRPackage.Literals.ASSOCIATION_POLICY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<REAPolicyEntity> getPolicyEntities() {
		if (policyEntities == null) {
			policyEntities = new EObjectResolvingEList<REAPolicyEntity>(REAPolicyEntity.class, this, REABRPackage.ASSOCIATION_POLICY__POLICY_ENTITIES);
		}
		return policyEntities;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<REAOperationalEntity> getOperationalEntities() {
		if (operationalEntities == null) {
			operationalEntities = new EObjectResolvingEList<REAOperationalEntity>(REAOperationalEntity.class, this, REABRPackage.ASSOCIATION_POLICY__OPERATIONAL_ENTITIES);
		}
		return operationalEntities;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case REABRPackage.ASSOCIATION_POLICY__POLICY_ENTITIES:
				return getPolicyEntities();
			case REABRPackage.ASSOCIATION_POLICY__OPERATIONAL_ENTITIES:
				return getOperationalEntities();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case REABRPackage.ASSOCIATION_POLICY__POLICY_ENTITIES:
				getPolicyEntities().clear();
				getPolicyEntities().addAll((Collection<? extends REAPolicyEntity>)newValue);
				return;
			case REABRPackage.ASSOCIATION_POLICY__OPERATIONAL_ENTITIES:
				getOperationalEntities().clear();
				getOperationalEntities().addAll((Collection<? extends REAOperationalEntity>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case REABRPackage.ASSOCIATION_POLICY__POLICY_ENTITIES:
				getPolicyEntities().clear();
				return;
			case REABRPackage.ASSOCIATION_POLICY__OPERATIONAL_ENTITIES:
				getOperationalEntities().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case REABRPackage.ASSOCIATION_POLICY__POLICY_ENTITIES:
				return policyEntities != null && !policyEntities.isEmpty();
			case REABRPackage.ASSOCIATION_POLICY__OPERATIONAL_ENTITIES:
				return operationalEntities != null && !operationalEntities.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //AssociationPolicyImpl
